package com.Txunda.fxw.ui.http;

import android.util.Log;

import com.Txunda.fxw.base.web.ApiListener;
import com.Txunda.fxw.base.web.ApiTool;
import com.Txunda.fxw.ui.toolkit.config.Config;
import com.lidroid.xutils.http.RequestParams;

/**
 * ����ģ��
 *
 * @author Administrator
 */
public class Office {

    /**
     * ��ʦ�������б�
     *
     * @param name
     * @param apiListener
     */
    public void officelist(String area_id, String type, String name, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addQueryStringParameter("area_id", area_id);
        params.addQueryStringParameter("name", name);
        params.addQueryStringParameter("type", type);
        apiTool.getApi(Config.BASE_URL + "Office/officelist", params, apiListener);
    }

    /**
     * ���ɷ���
     *
     * @param apiListener
     */
    public void lawList(ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        apiTool.getApi(Config.BASE_URL + "Office/lawList", params, apiListener);
    }

    /**
     * ��ʦ������
     *
     * @param o_id
     * @param name
     * @param apiListener
     */
    public void office(String o_id, String name, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        if (o_id != null && !o_id.equals("")) {
            params.addQueryStringParameter("o_id", o_id);
        }
        params.addQueryStringParameter("name", name);
        apiTool.getApi(Config.BASE_URL + "Office/office", params, apiListener);
    }

    /**
     * ��ʦ�б�
     *
     * @param name
     * @param p
     * @param apiListener
     */
    public void personList(String name, int p, String city_name, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addQueryStringParameter("name", name);
        params.addQueryStringParameter("p", p + "");
        params.addQueryStringParameter("city_name", city_name);
        apiTool.getApi(Config.BASE_URL + "Office/personList", params, apiListener);
    }

    /**
     * ��ʦ����
     *
     * @param p_id
     * @param apiListener
     */
    public void personDetail(String p_id, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addQueryStringParameter("p_id", p_id);
        apiTool.getApi(Config.BASE_URL + "Office/personDetail", params, apiListener);
    }

    /**
     * ��ʦ�������ĵ���ѡ��
     *
     * @param apiListener
     */
    public void areaList(ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        apiTool.getApi(Config.BASE_URL + "Office/areaList", params, apiListener);
    }

    /**
     * ��Ժר��
     *
     * @param o_id
     * @param apiListener
     */
    public void column(String o_id, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addBodyParameter("o_id", o_id);
        apiTool.postApi(Config.BASE_URL + "Office/column", params, apiListener);
    }

    /**
     * �����б�
     *
     * @param class_type
     * @param apiListener
     */
    public void articleList(String class_type, int p, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addQueryStringParameter("class", class_type);
        params.addQueryStringParameter("p", p + "");
        apiTool.getApi(Config.BASE_URL + "Office/articleList", params, apiListener);

    }

    /**
     * ���µ�����
     *
     * @param a_id
     * @param apiListener
     */
    public void articleDetail(String a_id, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addQueryStringParameter("a_id", a_id);
        apiTool.getApi(Config.BASE_URL + "Office/articleDetail", params, apiListener);
    }

    /**
     * ���ɿͷ�����
     *
     * @param apiListener
     */
    public void service(ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        apiTool.getApi(Config.BASE_URL + "Office/service", params, apiListener);
    }

    /**
     * ����ɸѡ�Ķ��м�
     *
     * @param province_id
     * @param apiListener
     */
    public void areaCity(String province_id, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addQueryStringParameter("province_id", province_id);
        apiTool.getApi(Config.BASE_URL + "Office/areaCity", params, apiListener);
    }

    /**
     * ����
     *
     * @param city_id
     * @param apiListener
     */
    public void areaDistrict(String city_id, ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addQueryStringParameter("city_id", city_id);
        apiTool.getApi(Config.BASE_URL + "Office/areaDistrict", params, apiListener);
    }

    /**
     * ��Ժ���ϱ�ȫ
     *
     * @param area_id ��ַɸѡ��������id
     * @param type    0Ĭ�ϴ����У�1������
     * @param name    ���Ĭ�Ͻ������Ǵ��������ƣ�ɸѡ���ǵĻ�type��0Ȼ��name������
     * @param api
     */
    public void preservationlist(String area_id, String type, String name, ApiListener api) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addQueryStringParameter("area_id", area_id);
        params.addQueryStringParameter("type", type);
        params.addQueryStringParameter("name", name);
        apiTool.getApi(Config.BASE_URL + "Office/preservationlist", params, api);
    }

    /**
     * ���ϱ�ȫ����
     *
     * @param id
     * @param name
     * @param api
     */
    public void preservation(String id, ApiListener api) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addQueryStringParameter("id", id);
        apiTool.getApi(Config.BASE_URL + "Office/preservation", params, api);
    }

    public void summary(ApiListener apiListener) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        apiTool.getApi(Config.BASE_URL + "Office/summary", params, apiListener);
    }


    public void summaryCity(String province_id, ApiListener api) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addQueryStringParameter("province_id", province_id);
        apiTool.getApi(Config.BASE_URL + "Office/summaryCity", params, api);
    }

    public void summaryDistrict(String city_id, ApiListener api) {
        RequestParams params = new RequestParams();
        ApiTool apiTool = new ApiTool();
        params.addQueryStringParameter("city_id", city_id);
        apiTool.getApi(Config.BASE_URL + "Office/summaryDistrict", params, api);
    }
}
